import Vue from "vue";
import VueRouter from "vue-router";
//import Main from '@/views/Main'
//// 集市 首页
//import MarketIndex from '@/views/market/index'
//// Im 系统
//import ImSeller from '@/views/market/im/seller'   // （im买家沟通页面）
//import ImBuyer from '@/views/market/im/buyer'   // （im卖家沟通页面）
//
//
//// 订单系统
//import Buy from '@/views/market/order/buy/buy' // 付款页面
//import BuyAddress from '@/views/market/order/buy/address'
//import BuyAddressAdd from '@/views/market/order/buy/add'
//import BuyAddressEdit from '@/views/market/order/buy/edit'
//import evaluate from '@/views/market/order/status/evaluate' // 订单评价页面
//import lookEvaluate from '@/views/market/order/status/lookEvaluate' // 查看订单评价
//import appendEvaluate from '@/views/market/order/status/appendEvaluate' // 查看订单评价
//
////=详情=
//import orderDetail from '@/views/market/order/status/detail' 
////=退款=
//import refundApply from '@/views/market/order/refund/apply' 
//import refundDetail from '@/views/market/order/refund/detail' 
//import refundSuccess from '@/views/market/order/refund/success'
//
//
//// 我买到的订单列表
//import reachBuy from '@/views/market/order/manager/reachBuy' 
//import releaseBuy from '@/views/market/order/manager/releaseBuy' 
//import sellOut from '@/views/market/order/manager/sellOut' 
//
//
//// 商品系统
//import Release from '@/views/market/tabbar/release' // 商品发布页
//import editRelease from '@/views/market/goods/editRelease' // 编辑发布的商品
//import GoodsDetail from '@/views/market/goods/detail' // 商品详情页 
//import preview from '@/views/market/goods/preview' // 商品预览页 
//import Snapshot from '@/views/market/goods/snapshot' // 商品详情页 
//import SearchIndex from '@/views/market/goods/search/index'  // 商品搜索页
//import releaseAgain from '@/views/market/goods/releaseAgain'  // 重新发布页面
//
//// 消息系统
//import msgIndex from '@/views/market/msg/index'
//import msgActivity from '@/views/market/msg/activity'
//import msgNotice from '@/views/market/msg/notice'
//import msgInteraction from '@/views/market/msg/interaction'
//
//// 个人中心系统
//import centerIndex from '@/views/market/center/index'
////=设置=
//import setIndex from '@/views/market/center/set/index'
//import addressIndex from '@/views/market/center/set/address/index'
//import addressAdd from '@/views/market/center/set/address/add'
//import addressEdit from '@/views/market/center/set/address/edit'
//import myInfo from '@/views/market/center/myInfo'  // 我的资料
//import homePage from '@/views/market/center/homePage'  // 个人主页
//import mySellOut from '@/views/market/center/mySellOut'  // 我卖出的
//
//
//// 列表系统
//import offBaby from '@/views/market/list/offBaby'   // 下架宝贝列表
//import soldOut from '@/views/market/list/soldOut'
//import myCollection from '@/views/market/list/myCollection' // 收藏列表
//import Browsed from '@/views/market/list/Browsed'   // 浏览列表
//import myRelease from '@/views/market/list/myRelease'  // 我发布的
Vue.use(VueRouter);
const routes = [
    // 外部重定向 只要不存在于其他主路径 都返回主页
    {
    	path: "*",
    	redirect:'/'
    },
    {
	    path: "/",
	    name: "index",
	    component: resolve=>require(['@/views/market/index'],resolve),
	    meta:{
	      keepAlive:true
	    }	    	
    },
	// 功能页面
	{
		path:'/otherFun',
		component: resolve=>require(['@/views/Main'],resolve),
		children:[
           {path:'buildIng',name:'buildIng',component:resolve=>require(['@/views/market/otherFun/buildIng'],resolve)},// 建设中
           {path:'errorScan',name:'errorScan',component:resolve=>require(['@/views/market/otherFun/errorScan'],resolve)},// 扫码错误页面
           {path:'strategy',name:'strategy',component:resolve=>require(['@/views/market/otherFun/strategy'],resolve)}// 扫码错误页面
		]
	},
	// 商品
	{
		path:'/market/goods',
		component: resolve=>require(['@/views/Main'],resolve),
		children:[
		  {path:'release',name:'Release',component:resolve=>require(['@/views/market/tabbar/release'],resolve)},// 发布
		  {path:'releaseAgain',name:'releaseAgain',component:resolve=>require(['@/views/market/tabbar/releaseAgain'],resolve)}, // 二次发布
		  {path:'preview',name:'preview',component:resolve=>require(['@/views/market/goods/preview'],resolve)}, // 预览
		  {path:'detail',name:'detail',component:resolve=>require(['@/views/market/goods/detail'],resolve)}, // 详情
		  {path:'shareDetail',name:'shareDetail',component:resolve=>require(['@/views/market/goods/shareDetail'],resolve)}, // 分享详情
		  {path:'categoryList',name:'categoryList',component:resolve=>require(['@/views/market/goods/categoryList'],resolve)}, // 商品类目列表
		  {path:'search',name:'search',component:resolve=>require(['@/views/market/goods/search/index'],resolve)}, // 商品搜索页面
		  {path:'searchList',name:'searchList',component:resolve=>require(['@/views/market/goods/search/searchList'],resolve)}, // 匹配商品搜索页面
		  {path:'im',name:'im',component:resolve=>require(['@/views/market/im/seller'],resolve)}, // im中转页面 后期会删除	
		  {path:'snapshot',name:'snapshot',component:resolve=>require(['@/views/market/goods/snapshot'],resolve)}, // 宝贝快照页面
		]
	},
	
	// 管理
	{
		path:'/market/manager',
		component: resolve=>require(['@/views/Main'],resolve),
		children:[
		  {path:'index',name:'managerIndex',component:resolve=>require(['@/views/market/manager/index'],resolve)},// 管理首页
		  {path:'setPage',name:'setPage',component:resolve=>require(['@/views/market/manager/setPage/index'],resolve)},// 个人设置主页
		  {path:'addressIndex',name:'addressIndex',component:resolve=>require(['@/views/market/manager/setPage/address/index'],resolve)},// 收货地址主页
          {path:'addressAdd',name:'addressAdd',component:resolve=>require(['@/views/market/manager/setPage/address/add'],resolve)},// 新增收货地址
          {path:'personal',name:'personal',component:resolve=>require(['@/views/market/manager/setPage/personal/index'],resolve)},// 个人资料主页
          {path:'homePage',name:'homePage',component:resolve=>require(['@/views/market/manager/homePage/index'],resolve)},// 个人中心主页
          {path:'follow',name:'follow',component:resolve=>require(['@/views/market/manager/homePage/list/follow'],resolve)},// 关注列表
          {path:'dz',name:'dz',component:resolve=>require(['@/views/market/manager/homePage/list/dz'],resolve)},// 点赞列表
          {path:'fans',name:'fans',component:resolve=>require(['@/views/market/manager/homePage/list/fans'],resolve)},// 粉丝列表
		]
	},
	
	// 列表
	{
		path:'/market/list',
		component: resolve=>require(['@/views/Main'],resolve),
		children:[
		  {path:'myRelease',name:'myRelease',component:resolve=>require(['@/views/market/list/myRelease'],resolve)}, // 我发布的
		  {path:'offBaby',name:'offBaby',component:resolve=>require(['@/views/market/list/offBaby'],resolve)}, // 下架宝贝
		  {path:'Browsed',name:'Browsed',component:resolve=>require(['@/views/market/list/Browsed'],resolve)}, // 浏览
		  {path:'myCollection',name:'myCollection',component:resolve=>require(['@/views/market/list/myCollection'],resolve)}, // 收藏的
		  {path:'sellOut',name:'sellOut',component:resolve=>require(['@/views/market/list/sellOut'],resolve)}, // 卖出的
		  {path:'myBuy',name:'myBuy',component:resolve=>require(['@/views/market/list/myBuy'],resolve)}, // 买到的
		  {path:'myBuy',name:'myBuy',component:resolve=>require(['@/views/market/list/myBuy'],resolve)}, // 活动消息
		]
	},
 
	// 提现
	{
		path:'/market/withdrawal',
		component: resolve=>require(['@/views/Main'],resolve),
		children:[
		  {path:'index',name:'withdrawalIndex',component:resolve=>require(['@/views/market/withdrawal/index'],resolve)}, // 提现首页
		  {path:'mode',name:'mode',component:resolve=>require(['@/views/market/withdrawal/mode'],resolve)}, // 提现方式
		  {path:'ali',name:'mode',component:resolve=>require(['@/views/market/withdrawal/payInfo/ali'],resolve)}, // 支付宝提现
		  {path:'wx',name:'mode',component:resolve=>require(['@/views/market/withdrawal/payInfo/wx'],resolve)}, // 微信提现
		  {path:'bank',name:'mode',component:resolve=>require(['@/views/market/withdrawal/payInfo/bank'],resolve)}, // 银行卡提现
		  {path:'progress',name:'progress',component:resolve=>require(['@/views/market/withdrawal/progress'],resolve)}, // 提现进度
		  {path:'bill',name:'bill',component:resolve=>require(['@/views/market/withdrawal/bill'],resolve)}, // 账单明细
		]
	},
	// 支付流程
	{
		path:'/market/orderPay',
		component: resolve=>require(['@/views/Main'],resolve),
		children:[
		  {path:'goodsInfo',name:'goodsInfo',component:resolve=>require(['@/views/market/pay/goodsInfo'],resolve)}, // 确认商品详情页面
		  {path:'orderInfo',name:'orderInfo',component:resolve=>require(['@/views/market/pay/payInfo'],resolve)}, // 确认商品详情页面
		]
	},
	// 小法庭(客服介入)
	{
		path:'/market/intervention',
		component: resolve=>require(['@/views/Main'],resolve),
		children:[
		  {path:'index',name:'interventionIndex',component:resolve=>require(['@/views/market/intervention/index'],resolve)}, // 客服介入申请首页
		  {path:'front',name:'front',component:resolve=>require(['@/views/market/intervention/front'],resolve)}, // 客服介入同意页面
		  {path:'detail',name:'detail',component:resolve=>require(['@/views/market/intervention/detail'],resolve)}, // 客服介入_详情页面(买家)
		  {path:'detail2',name:'detail2',component:resolve=>require(['@/views/market/intervention/detail2'],resolve)}, // 客服介入_详情页面(卖家)		  
		  {path:'voucher',name:'voucher',component:resolve=>require(['@/views/market/intervention/voucher'],resolve)},// 提交凭证(买家上传凭证)
		  {path:'voucher2',name:'voucher2',component:resolve=>require(['@/views/market/intervention/voucher2'],resolve)},// 提交凭证(卖家上传凭证)		  
		  {path:'result',name:'result',component:resolve=>require(['@/views/market/intervention/result'],resolve)},// 小法庭结果页面
		]
	},
	//订单和退款--新
	{
    	path:'/market/orders',
    	component:resolve=>require(['@/views/Main'],resolve),
    	children:[
		  {path:'details',name:'orderDetails',component:resolve=>require(['@/views/market/orders/orderDetail/detail'],resolve)},
		  {path:'moneys',name:'detailMoneys',component:resolve=>require(['@/views/market/orders/orderDetail/money'],resolve)},
		  {path:'buymoney',name:'buymoney',component:resolve=>require(['@/views/market/orders/orderDetail/buymoney'],resolve)},
		  {path:'refund',name:'refund',component:resolve=>require(['@/views/market/orders/refund/detail'],resolve)},
		  {path:'refunds',name:'refunds',component:resolve=>require(['@/views/market/orders/refund/refundDetail'],resolve)},//买家退款详情
		  {path:'sellrefundDetail',name:'sellrefundDetail',component:resolve=>require(['@/views/market/orders/refund/sellrefundDetail'],resolve)},//卖家退款详情
		  {path:'address',name:'address',component:resolve=>require(['@/views/market/orders/refund/address'],resolve)},
		  {path:'refuse',name:'refuse',component:resolve=>require(['@/views/market/orders/refund/refuse'],resolve)},
		  {path:'history',name:'history',component:resolve=>require(['@/views/market/orders/refund/history'],resolve)},
		  {path:'company',name:'company',component:resolve=>require(['@/views/market/orders/refund/company'],resolve)},
		  {path:'information',name:'information',component:resolve=>require(['@/views/market/orders/refund/information'],resolve)},
		  {path:'apply',name:'apply',component:resolve=>require(['@/views/market/orders/refund/apply'],resolve)},
		  {path:'goods',name:'goods',component:resolve=>require(['@/views/market/orders/refund/goods'],resolve)},
		  {path:'modify',name:'modify',component:resolve=>require(['@/views/market/orders/refund/modify'],resolve)},
		  {path:'refundMoney',name:'refundMoney',component:resolve=>require(['@/views/market/orders/refund/refundMoney'],resolve)},
		  {path:'edit',name:'edit',component:resolve=>require(['@/views/market/orders/refund/edit'],resolve)},
		  {path:'manageAddress',name:'manageAddress',component:resolve=>require(['@/views/market/orders/refund/manageAddress'],resolve)},
		  {path:'expressDetail',name:'expressDetail',component:resolve=>require(['@/views/market/orders/refund/expressDetail'],resolve)},
    	]
   }, 		
	// im辅助页面
	{
		path:'/market/im',
		component:resolve=>require(['@/views/Main'],resolve),
		children:[
		  {path:'notice',name:'msgNotice',component:resolve=>require(['@/views/market/im/notice'],resolve)},// 通知消息
		  {path:'interaction',name:'msginteraction',component:resolve=>require(['@/views/market/im/interaction'],resolve)},	 // 互动消息
		  {path:'evaluate',name:'evaluate',component:resolve=>require(['@/views/market/im/evaluate'],resolve)},	 // 评价
		  {path:'seeEvaluate',name:'seeEvaluate',component:resolve=>require(['@/views/market/im/seeEvaluate'],resolve)},	 // 查看评价
		  {path:'standard',name:'standard',component:resolve=>require(['@/views/market/im/standard'],resolve)},	 // 交易规范
		  {path:'editPrice',name:'editPrice',component:resolve=>require(['@/views/market/im/editPrice'],resolve)},	 // 交易规范
		]
	},	
	// 合伙人
	{
		path:'/market/partner',
		component:resolve=>require(['@/views/Main'],resolve),
		children:[
		  {path:'index',name:'partnerIndex',component:resolve=>require(['@/views/market/partner/index'],resolve)},// 通知消息
		]
	},
	// 去发货
	{
		path:'/market/deliver',
		component:resolve=>require(['@/views/Main'],resolve),
		children:[
		  {path:'index',name:'deliverIndex',component:resolve=>require(['@/views/market/deliver/index'],resolve)},// 发货首页
		  {path:'input',name:'deliverInput',component:resolve=>require(['@/views/market/deliver/input'],resolve)},// 填写信息页
		]
	},	

  
];

const router = new VueRouter({
	mode:'history',
    routes,
	scrollBehavior (to, from, savedPosition) {		
	    return { x: 0, y: 0 }
	}
});

export default router;
